package com.zy.controller;

import com.zy.entity.Message;
import com.zy.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@ResponseBody
@RequestMapping("/message")
public class MessageController
{

    @Autowired
    private MessageService messageService;

    @GetMapping("/sendMessage")
    public Map<String,Object> sendMessage(Message message)
    {
        return messageService.sendMessage(message);
    }

    @GetMapping("/findMessageListByUser")
    public Map<String,Object> findMessageListByUser(Message message,int pageNo,int pageSize)
    {
        return messageService.findMessageListByUser(message,pageNo,pageSize);
    }

    @GetMapping("/messagePageTotal")
    public Map<String,Object> messagePageTotal(Message message,int pageSize)
    {
        return messageService.messagePageTotal(message,pageSize);
    }

}
